@extends('layouts.admin.application')

@section('content')
    <div class="main-content">
        <div class="col-xs-12">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="#">首页</a></li>
                    <li><a href="{{ route('blog.gallery.index') }}">我的照片</a></li>
                    <li class="active">上传照片</li>
                </ul>
            </div>

            @include('layouts.partials._flash')

            <form class="form-horizontal" role="form" action="{{ route('blog.photo.store') }}" method="post"
                  style="margin-top: 10px;">

                {{csrf_field()}}

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">上传到：</label>

                    <div class="col-sm-9">
                        <select class="width-25" name="gallery_id">
                            @foreach($galleries as $gallery)
                                <option value="{{$gallery->id}}">{{$gallery->name}}</option>
                            @endforeach

                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">照片名称：</label>

                    <div class="col-sm-9">
                        <div class="input-group" style="width: 358px;">
                            <input class="form-control datepicker" type="text" name="name" placeholder="请选择时间"/>
                            <span class="input-group-addon"><i class="icon-calendar bigger-110"></i></span>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">照片描述：</label>

                    <div class="col-sm-9">
                        <textarea name="description" cols="48" rows="4" placeholder="说说这张照片的故事..."></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">上传照片：</label>

                    <div class="col-sm-9">
                        <div class="am-form-group am-form-file new_thumb">
                            <button type="button" class="btn-success upload_img" style="width: 120px;">
                                <i class="icon-cloud-upload" id="loading"></i> 上 传 美 照
                            </button>
                            <input type="file" id="image_upload" style="display: none;">
                            <input type="hidden" name="image">
                        </div>
                        <hr style="border-top:1px dashed #0066CC;">
                        <div>
                            <img src="" id="img_show" style="max-height: 200px;">
                        </div>
                    </div>
                </div>


                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>保存</button>
                        &nbsp; &nbsp; &nbsp;
                        <a class="btn" onclick="javascript:history.back(-1);return false;"><i
                                    class="icon-undo bigger-110"></i>返回</a>
                    </div>
                </div>
            </form>
        </div>

    </div>
@endsection

@section('js')
    <script src="/vendor/html5-fileupload/jquery.html5-fileupload.js"></script>
    <script src="/js/upload.js"></script>
    <script src="/ace/assets/js/date-time/bootstrap-datepicker.min.js"></script>
    <script src="/ace/assets/js/date-time/bootstrap-datepicker.zh-CN.js"></script>
    <script src="/ace/assets/js/date-time/moment.min.js"></script>
    <script>
        $(function () {
            $('.datepicker').datepicker({
                format: 'yyyy-mm-dd',
                language: 'zh-CN'
            });
        })
    </script>
@endsection